<?php
/*
    Lightweight and multiplatform PHP Multithreading Engine
    Copyright (C) 2008  Anton Vedeshin (anton@vedeshin.com, http://anton.vedeshin.com)
	
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

function calculate($c,$object_array,$proc_id){
	$l=new logger("calculate_".$proc_id);
	$count=0;
	$badly_imported=false;
	$limit=5; //for testing purposes, if you would like just check before production
	$l->lw(1,"job count: ".count($object_array)."\n");
	$query="";
	$query2="";
	$new_value="";

	foreach ($object_array as $element){
		/*		
			put your business logic here
			results accumulate into $query object
			optionally you can directly put results somewhere to the databse, ftp
			
		*/		
		$l->lw(1,"Calculation: ".($count++));
	}
	
	$l->lw(1,"Exit calculation \n");
	$return_param[]=$query;
	$return_param[]=$badly_imported;
	return $return_param;
}

?>